//
//  XMMineUserInfoView.m
//  XunMi
//
//  Created by MacBook on 2024/2/19.
//  Copyright © 2024 TieZhu. All rights reserved.
//

#import "XMMineUserInfoView.h"

@interface XMMineUserInfoView ()
@property (weak, nonatomic) IBOutlet UIImageView *userHeadImg;
@property (weak, nonatomic) IBOutlet UILabel *userNameLa;
@property (weak, nonatomic) IBOutlet UIImageView *vipImg;
@property (weak, nonatomic) IBOutlet UIButton *idBtton;


@end

@implementation XMMineUserInfoView

- (void)awakeFromNib {
    [super awakeFromNib];
    
}

- (void)reload {
    [_userHeadImg sd_setImageWithURL:kStringToUrl(kUserModel.avatar.file_url) placeholderImage:kUserModel.isMan ? kManHeadImg : kWomanHeadImg];
    self.userNameLa.text = kUserModel.nickname;
    [self.idBtton setTitle:kStringFormat(@"寻觅ID:%@",kUserModel.person_id) forState:UIControlStateNormal];
    
    self.userNameLa.textColor = [XMUtil isBlankString:kUserModel.member_time] ? k1F1F1F : kMemberNameColor;
    self.vipImg.hidden = [XMUtil isBlankString:kUserModel.member_time];
}

- (void)layoutSubviews {
    [super layoutSubviews];
    kCornerRadius(_userHeadImg, 30, 0, UIColor.clearColor);
    [_idBtton setImagePosition:(XMImagePositionRight) spacing:12];
}

- (IBAction)idAction:(UIButton *)sender {
    if (self.editBlock) {
        self.editBlock();
    }
}

@end
